<include file="Public:wapheader" />
		<div class="page13">
			<form name="form-phone" action="{:U('cust/save')}" method="post" id="form-phone">
			<div class="mainner">
				<div class="title">
					<a href="#"></a>
					<a class="on" href="#"></a>
				</div>
				
				<div class="list1">
					<h4>需求信息</h4>
					<p>
						<label>选择小区</label>
						<span>
							<input type="text" name="estate" id="autocomplete" placeholder="输入小区名" class="required" />
							<input type="hidden"  name="area_id" id="area_id" >
							<input type="hidden"  name="estate_id" id="estate_id" >
							<input type="hidden"  name="id" value="{$cid}" >
						</span>
					</p>
					<p>
						<label>面积</label>
						<span>
							<input type="text" name="area" class="fill" placeholder="点击输入" />
						</span>
					</p>
					<p>
						<label>户型</label>
						<span>
							<input type="text" name="used_type" class="" placeholder="点击输入" />
						</span>
					</p>
					<p>
						<label>朝向</label>
						<span>
								<select name="aspect">
								<option value="10">西北</option>
									<option value="9">西南</option>
									<option value="8">东北</option>
									<option value="7">东南</option>
									<option value="6">南北</option>
									<option value="5">东西</option>
									<option value="4" selected>北</option>
									<option value="3">南</option>
									<option value="2">西</option>
									<option value="1">东</option>
							</select>
						</span>
					</p>
					<p>
						<label>价格</label>
						<span>
							<input type="text" name="price" class="fill"  placeholder="点击输入" />
						</span>
					</p>
					<p>
						<label>楼层</label>
						<span>
							<input type="text" name="fool_scope" class="fill"  placeholder="点击输入" />
						</span>
					</p>
					<p>
						<label>总楼层</label>
						<span>
							<input type="number" name="fool_total" class="" placeholder="请输入" />
						</span>
					</p>

				</div>
			</div>
			
			<div class="btn_submit">
				<input type="submit" value="完成" class="next-btn">
			</div>
			</form>
		</div>
	</body>
<script src="__S__/js/ajaxfileupload.js"></script>
<script src="__S__/js/jquery.validate.js"></script>
<script src="__S__/js/magess.js"></script>
<script src="__S__/js/jquery.metadata.js"></script>
<script type="text/javascript">
	$().ready(function() {
		$("#form-phone").validate();
		jQuery.validator.addMethod("ismobile", function(value, element) {
			var length = value.length;
			var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
			return this.optional(element) || (length == 11 && mobile.test(value));
		}, "请正确填写您的手机号码");
	});
</script>
<script>
	//自动填充
	$( "#autocomplete" ).autocomplete({
		source: "{:U ('Ajax/autoEstate')}",
		select: function(event, ui){
			$(this).val (ui.item.label);
			$('#area_id').val (ui.item.area_id);
			$('#estate_id').val (ui.item.value);
			$('#estate').val (ui.item.label);
			event.preventDefault();
		}
	});
	$('.fill').click(function (){
		var obj = $(this).prop('name');
		layer.open({
			type: 1,
			title: '请选择',
			area: ['80%', '300px'],
			content: '<div><div style="margin: 0 auto;text-align:center"><ul id="u-type">' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px">起始</label><input class="editbox" type="number" name="star" min="0" style="height: 30px"></li>' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px"><label>|</label></li>' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px">结束</label><input class="editbox" type="number" name="end" min="0" style="height: 30px"</li>' +
			'</ul><button class="greenbuttoncss" onclick="addType (\''+obj+'\')">确定</button></div></div>'
		});
	});
	function addType (tar){
		var star = $('input[name=star]').val()?$('input[name=star]').val():0;
		var end = $('input[name=end]').val()?$('input[name=end]').val():0;
		var v = star==0 && end==0?'不限':star+'-'+end;
		$('input[name='+tar+']').prop ('value', v);
		layer.closeAll();
	}
	$('input[name=used_type]').click(function (){
		layer.open({
			type: 1,
			title: '请选择',
			area: ['80%', '300px'],
			content: '<div><div style="margin: 0 auto;text-align:center"><ul id="u-type">' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px">室</label><input class="editbox" type="number" name="chamber" min="0" style="height: 30px"></li>' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px">厅</label><input class="editbox" type="number" name="hall" min="0" style="height: 30px"></li>' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px">厨</label><input class="editbox" type="number" name="kitchen" min="0" style="height: 30px"</li>' +
			'<li style="padding: 10px 10px"><label style="margin-right: 20px">卫</label><input class="editbox" type="number" name="toilet" min="0" style="height: 30px"></li>' +
			'</ul><button class="greenbuttoncss" onclick="addType_ (this)">确定</button></div></div>'
		});
	});
	function addType_ (tar){
		var chamber = $('input[name=chamber]').val()?$('input[name=chamber]').val():1;
		var hall = $('input[name=hall]').val()?$('input[name=hall]').val():0;
		var kitchen = $('input[name=kitchen]').val()?$('input[name=kitchen]').val():0;
		var toilet = $('input[name=toilet]').val()?$('input[name=toilet]').val():0;
		$('input[name=used_type]').prop ('value', chamber+'-'+hall+'-'+kitchen+'-'+toilet);
		layer.closeAll();
	}
</script>
</html>
